<?php
namespace services\models;

class delivery_promiese {
    
    private $_db;
    private $_cache;


    public function __construct() {
        $config = include ROOT_CONFIG;
        
        $this->_db = \PDOWrapper::instance();
        $this->_db->configMaster($config['db']['master']);        
        $this->_cache = \wrapperCache::GetInstance($config['apc_cache']['cache_type'],
                                                    $config['apc_cache']['cache_expire'],
                                                    $config['apc_cache']['cache_path']);
    }

    public function get_province_time($province_id) {
        
        if(isset($province_id)){
            if($this->_cache->cache('province_name_' . $province_id)){
                return $this->_cache->cache('province_name'. $province_id);
            }else {
                $result = $this->_db->selectFirst('province', array('province_name'=> $province_id));
                $this->_cache->cache( 'province_name'. $province_id, $result);
                return $result;
            }
        }
    }
}


?>
